package com.apiit.webserviceclient;

import com.apiit.webserviceclient.db.Authentication;
import com.apiit.webserviceclient.db.Authentication_DAO;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class Admin_Activity extends Activity {
	private Authentication_DAO datasource;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_admin_);
		
		Button b1 = (Button) findViewById(R.id.Adminbutton2);
		final EditText ed1 = (EditText) findViewById(R.id.AdmineditText1);
		final EditText ed2 = (EditText) findViewById(R.id.AdminEditText01);
		final EditText ed3 = (EditText) findViewById(R.id.AdminEditText02);
		final EditText ed4 = (EditText) findViewById(R.id.AdminEditText03);
		final EditText ed5 = (EditText) findViewById(R.id.AdminEditText04);
		final EditText ed6 = (EditText) findViewById(R.id.AdminEditText05);
		final EditText ed7 = (EditText) findViewById(R.id.AdminEditText06);
		final EditText ed8 = (EditText) findViewById(R.id.AdminEditText07);
		
		datasource = new Authentication_DAO(this);
		
		b1.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				
				datasource.open();
//
//				Authentication action = new Authentication();
//				action.setAction_id(Long.parseLong(ed1.getText().toString()));
//				action.setCookies("");
//				action.setIs_authenticated(Long.parseLong(ed2.getText().toString()));
//				action.setUser_name_key(ed3.getText().toString());
//				action.setUser_name_value(ed4.getText().toString());
//				action.setPassword_key(ed5.getText().toString());
//				action.setPassword_value(ed6.getText().toString());
//				action.setExtra_params(ed7.getText().toString());
//				action.setCookie_id(Long.parseLong(ed8.getText().toString()));
				
		//		datasource.createAction(action);
				
				datasource.close();
			}
		});
			
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		//getMenuInflater().inflate(R.menu.admin_, menu);
		return true;
	}

}
